<!DOCTYPE html>  
<html xmlns:th="http://www.thymeleaf.org" lang="zh-CN"> 
<head> 
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
	<meta name="viewport" content="width=device-width, initial-scale=1"/>
	<title>优惠券设置</title>
	<!-- 常规css -->
    <link th:href="@{bootstrap/css/bootstrap.min.css}" rel="stylesheet" />
    <link th:href="@{font-awesome/css/font-awesome.min.css}" rel="stylesheet" />
    <!-- 项目css -->
    <link th:href="@{css/layout.css}" rel="stylesheet" />
</head> 
<body th:with="asort=${#httpServletRequest.getParameter('sort')}, aorder=${#httpServletRequest.getParameter('order')}, num=${data.num}, pageIndex=${data.pageIndex}">
	<!-- 侧边导航栏 -->
	<div th:replace="aframe::sideNavigation"></div>
	
	<!-- 主页面 -->
	<div class="content" style="padding:0">
		<!-- 顶部导航栏 -->
		<div th:replace="aframe::topNavigation"></div>
		<!-- 内容 -->

		<!-- 标签页内容 -->
		<div role="tabpanel" class="tab-pane active" id="history" style="margin:20px">
			<div class="panel panel-default" >
				<div class="panel-heading">
					<h4>优惠券设置&nbsp;&nbsp;
						<span><button class="btn btn-sm btn-success" th:onclick="showAdd()">新增优惠券</button></span>
					</h4>
				</div>
				<div class="panel-body table-responsive">
					<table class="table table-hover">
						<thead>
						<tr>
							<th>编号</th>
							<th>优惠券名</th>
							<th>优惠金额</th>
							<th>满减底价</th>
							<th>优惠范围</th>
							<th>有效时长</th>
							<th>操作</th>
						</tr>
						</thead>
						<tbody>
						<tr th:each="tem: ${data.list}">
							<th scope="row" th:text="${tem?.temId}">编号</th>
							<td th:text="${tem?.temName}">优惠券名</td>
							<td th:text="${tem?.temNumber} + ' 元'">优惠金额</td>
							<td th:text="${tem?.temBottomPrice} + ' 元'">满减底价</td>
							<div th:switch="${tem?.temRange}">
								<td th:case="0">不限</td>
								<td th:case="1">食品/保健类</td>
								<td th:case="2">服饰类</td>
								<td th:case="3">皮具箱包类</td>
								<td th:case="4">珠宝饰品类</td>
								<td th:case="5">母婴/儿童类</td>
								<td th:case="6">家电类</td>
								<td th:case="7">数码类</td>
								<td th:case="8">汽车配件类</td>
								<td th:case="9">家具/建材类</td>
								<td th:case="10">图书影音类</td>
							</div>
							<td th:text="${tem?.temTimespan} + ' 天'">有效时长</td>
							<td>
								<button class="btn btn-sm btn-success"  th:onclick="showSend([[${tem?.temId}]])">发放</button>
								<button class="btn btn-sm btn-primary"  th:onclick="showEdit([[${tem?.temId}]])">编辑</button>
								<button class="btn btn-sm btn-danger"  th:onclick="showDelete([[${tem?.temId}]])">删除</button>
							</td>
						</tr>
						</tbody>
					</table>

					<!-- 分页 -->
					<div th:replace="aframe::pagingBar"></div>

				</div>
			</div>
		</div>
	</div>
		<!-- end 内容 -->
	<!-- end 主页面 -->


	<!-- 模态框: 编辑 -->
	<form class="form-horizontal" role="form" id="editForm" style="margin: 20px;">
		<div class="modal fade" id="editModal" tabindex="-1" role="dialog" aria-labelledby="editModalLabel" aria-hidden="true">
			<div class="modal-dialog">
				<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
						<h4 class="modal-title" id="editModalLabel"> 编辑优惠券 </h4>
					</div>
					<div class="modal-body">
						<div class="form-group">
							<input type="hidden" name="temId" id="e_temId">
							<label class="col-sm-3 control-label">优惠券名</label>
							<div class="col-sm-7">
								<input type="text" class="form-control" id="e_temName" name="temName" placeholder="请输入优惠券名">
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label">优惠金额(元)</label>
							<div class="col-sm-7">
								<input type="text" class="form-control" id="e_temNumber" name="temNumber" placeholder="请输入优惠金额">
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label">满减底价(元)</label>
							<div class="col-sm-7">
								<input type="text" class="form-control" id="e_temBottomPrice" name="temBottomPrice" placeholder="请输入满减底价">
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label">优惠范围</label>
							<div class="col-sm-7">
								<select name="temRange" id="e_temRange" class="form-control">
									<option value="0">不限</option>
									<option value="1">食品/保健类</option>
									<option value="2">服饰类</option>
									<option value="3">皮具箱包类</option>
									<option value="4">珠宝饰品类</option>
									<option value="5">母婴/儿童类</option>
									<option value="6">家电类</option>
									<option value="7">数码类</option>
									<option value="8">汽车配件类</option>
									<option value="9">家具/建材类</option>
									<option value="10">图书影音类</option>
								</select>
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label">有效时长(天)</label>
							<div class="col-sm-7">
								<input type="text" class="form-control" id="e_temTimespan" name="temTimespan" placeholder="请输入有效时长">
							</div>
						</div>
					</div>
					<div class="modal-footer">
						<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
						<button type="button" class="btn btn-primary" id="editButton">确认修改</button>
					</div>
				</div>
			</div>
		</div>
	</form>

	<!-- 模态框: 添加 -->
	<form class="form-horizontal" role="form" id="addForm" style="margin: 20px;">
		<div class="modal fade" id="addModal" tabindex="-1" role="dialog" aria-labelledby="addModalLabel" aria-hidden="true">
			<div class="modal-dialog modal-lg">
				<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
						<h4 class="modal-title" id="addModalLabel"> 新增优惠券 </h4>
					</div>
					<div class="modal-body">
						<div class="form-group">
							<label class="col-sm-3 control-label">优惠券名</label>
							<div class="col-sm-7">
								<input type="text" class="form-control" id="a_temName" name="temName" placeholder="请输入优惠券名">
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label">优惠金额(元)</label>
							<div class="col-sm-7">
								<input type="text" class="form-control" id="a_temNumber" name="temNumber" placeholder="请输入优惠金额">
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label">满减底价(元)</label>
							<div class="col-sm-7">
								<input type="text" class="form-control" id="a_temBottomPrice" name="temBottomPrice" placeholder="请输入满减底价">
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label">优惠范围</label>
							<div class="col-sm-7">
								<select name="temRange" id="a_temRange" class="form-control">
									<option value="0">不限</option>
									<option value="1">食品/保健类</option>
									<option value="2">服饰类</option>
									<option value="3">皮具箱包类</option>
									<option value="4">珠宝饰品类</option>
									<option value="5">母婴/儿童类</option>
									<option value="6">家电类</option>
									<option value="7">数码类</option>
									<option value="8">汽车配件类</option>
									<option value="9">家具/建材类</option>
									<option value="10">图书影音类</option>
								</select>
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label">有效时长(天)</label>
							<div class="col-sm-7">
								<input type="text" class="form-control" id="a_temTimespan" name="temTimespan" placeholder="请输入有效时长">
							</div>
						</div>
					</div>
					<div class="modal-footer">
						<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
						<button type="button" class="btn btn-primary" id="addButton">确认添加</button>
					</div>
				</div>
			</div>
		</div>
	</form>

	<!-- 模态框: 修改密码 -->
	<div th:replace="aframe::modifyPwd"></div>


<!-- 常规js -->
<script th:src="@{js/jquery-3.4.1.min.js}"></script>
<script th:src="@{bootstrap/js/bootstrap.min.js}"></script>
<!-- 模板js -->
<script th:replace="aframe::js-highlight"></script>
<!-- 项目js -->
<script th:src="@{js/md5.js}"></script>
<script th:src="@{js/setpwd.js}"></script>
<!-- 页面js -->
<script th:src="@{js/tem.js}"></script>

</body>
</html> 

